﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MatchServer.Core
{
    class MUIDGenerator
    {
        private static UInt64 muidIndex = 0;
        private static object muidLock = null;
        
        public MUIDGenerator ()
        {
            muidIndex = 1;
            muidLock = new object();
        }

        public UInt64 newMUID()
        {
            lock (muidLock)
            {
                if (muidIndex == 0xFFFFFFFFFFFFFFFF)
                    muidIndex = 1;
                return muidIndex++;
            }
        }
    }
}
